package com.tongcao.cn.stackoverflow;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import org.assertj.core.util.Compatibility;

import java.io.Serializable;

/**
 * @Author:tongcao
 * @Date:2019/3/25 16:39
 * Description:
 */
@Data
public class Person {

    private static final long serialVersionUID = 1L;

    private String name;
    private Integer age;
    private String address;

    public Person() {
    }

    public Person(String name, Integer age, String address) {
        this.name = name;
        this.age = age;
        this.address = address;
    }

    public Person(String name, Integer age, String address, String email) {
        this.name = name;
        this.age = age;
        this.address = address;
    }

    class Per1 extends Person {
    }


    public static void main(String[] args) {
        Person person = new Person("11", 29, "湖南湘潭");

        String s = JSON.toJSONString(person);
//        Compatibility.System.out.println(s);

        Object o1 = JSON.parse(s);

        System.out.println(o1);

        Person o11 = (Person) o1;
        System.out.println(o11);
        System.out.println(JSON.toJSONString(o11));
    }
}
